home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Utilities / Ghostscript / src / gsstype.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-01  |  3.8 KB  |  116 lines

  1. /* Copyright (C) 1999 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of AFPL Ghostscript.
  4.   
  5.   AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author or
  6.   distributor accepts any responsibility for the consequences of using it, or
  7.   for whether it serves any particular purpose or works at all, unless he or
  8.   she says so in writing.  Refer to the Aladdin Free Public License (the
  9.   "License") for full details.
  10.   
  11.   Every copy of AFPL Ghostscript must include a copy of the License, normally
  12.   in a plain ASCII text file named PUBLIC.  The License grants you the right
  13.   to copy, modify and redistribute AFPL Ghostscript, but only under certain
  14.   conditions described in the License.  Among other things, the License
  15.   requires that the copyright notice and this notice be preserved on all
  16.   copies.
  17. */
  18.  
  19. /*$Id: gsstype.h,v 1.2 2000/09/19 19:00:32 lpd Exp $ */
  20. /* Definition of structure type descriptors and extern_st */
  21.  
  22. #ifndef gsstype_INCLUDED
  23. #  define gsstype_INCLUDED
  24.  
  25. /* Define an opaque type for the garbage collector state. */
  26. typedef struct gc_state_s gc_state_t;
  27.  
  28. /*
  29.  * Define the structure used to return an enumerated pointer.  Ordinary
  30.  * object pointers use only the ptr element; strings also use size.
  31.  */
  32. typedef struct enum_ptr_s {
  33.     const void *ptr;
  34.     uint size;
  35. } enum_ptr_t;
  36.  
  37. /*
  38.  * The first argument of enum_ptrs procedures formerly was not const *, and
  39.  * EV_CONST was defined as empty.  Unfortunately, changing EV_CONST to const
  40.  * produced many compiler warnings from places that cast this argument to a
  41.  * non-const non-void pointer type.
  42.  */
  43. #define EV_CONST const
  44.  
  45. /* Define the procedures for structure types. */
  46.  
  47.         /* Clear the marks of a structure. */
  48.  
  49. #define struct_proc_clear_marks(proc)\
  50.   void proc(P3(void /*obj_header_t*/ *pre, uint size,\
  51.     const gs_memory_struct_type_t *pstype))
  52.  
  53.         /* Enumerate the pointers in a structure. */
  54.  
  55. #define struct_proc_enum_ptrs(proc)\
  56.   gs_ptr_type_t proc(P6(EV_CONST void /*obj_header_t*/ *ptr, uint size,\
  57.     int index, enum_ptr_t *pep, const gs_memory_struct_type_t *pstype,\
  58.     gc_state_t *gcst))
  59.  
  60.         /* Relocate all the pointers in this structure. */
  61.  
  62. #define struct_proc_reloc_ptrs(proc)\
  63.   void proc(P4(void /*obj_header_t*/ *ptr, uint size,\
  64.     const gs_memory_struct_type_t *pstype, gc_state_t *gcst))
  65.  
  66.         /*
  67.          * Finalize this structure just before freeing it.
  68.          * Finalization procedures must not allocate or resize
  69.          * any objects in any space managed by the allocator,
  70.          * and must not assume that any objects in such spaces
  71.          * referenced by this structure still exist.  However,
  72.          * finalization procedures may free such objects, and
  73.          * may allocate, free, and reference objects allocated
  74.          * in other ways, such as objects allocated with malloc
  75.          * by libraries.
  76.          */
  77.  
  78. #define struct_proc_finalize(proc)\
  79.   void proc(P1(void /*obj_header_t*/ *ptr))
  80.  
  81. /*
  82.  * A descriptor for an object (structure) type.
  83.  */
  84. typedef struct struct_shared_procs_s struct_shared_procs_t;
  85.  
  86. struct gs_memory_struct_type_s {
  87.     uint ssize;
  88.     struct_name_t sname;
  89.  
  90.     /* ------ Procedures shared among many structure types. ------ */
  91.     /* Note that this pointer is usually 0. */
  92.  
  93.     const struct_shared_procs_t *shared;
  94.  
  95.     /* ------ Procedures specific to this structure type. ------ */
  96.  
  97.     struct_proc_clear_marks((*clear_marks));
  98.     struct_proc_enum_ptrs((*enum_ptrs));
  99.     struct_proc_reloc_ptrs((*reloc_ptrs));
  100.     struct_proc_finalize((*finalize));
  101.  
  102.     /* A pointer to additional data for the above procedures. */
  103.  
  104.     const void *proc_data;
  105. };
  106.  
  107. /*
  108.  * Because of bugs in some compilers' bookkeeping for undefined structure
  109.  * types, any file that uses extern_st must include this file.
  110.  * (If it weren't for these bugs, the definition of extern_st could
  111.  * go in gsmemory.h.)
  112.  */
  113. #define extern_st(st) extern const gs_memory_struct_type_t st
  114.  
  115. #endif /* gsstype_INCLUDED */
  116.